#!/usr/bin/env python2
import Combinations, Matches

def RepeatMatchCount(match):
    return sum([ Matches.GetMatchCount(a[0], a[1]) for a in Combinations.GetAllCombinations(match, 2) ])

def SameRegionMatchCount(match):
    return len([ a for a in Combinations.GetAllCombinations(match, 2) if a[0].region == a[1].region])

def RepeatRegionMatchCount(match, teamList):
    return sum([sum([Matches.GetMatchCount(b, a[1]) for b in teamList if b.region == a[0].region]) + sum([Matches.GetMatchCount(b, a[0]) for b in teamList if b.region == a[1]]) for a in Combinations.GetAllCombinations(match, 2)])
